﻿using System;
using System.Collections;

namespace KWatkins.FluentMoqBuilder.Argument
{
	internal sealed class CollectionValidation<T> : ArgumentValidation<T>,
		ICollection<T>, ICollectionNotNull<T>
		where T : ICollection
	{
		internal CollectionValidation(T argument, string parameterName)
			: base(argument, parameterName)
		{
		}

		#region ICollection<T> Members
		ICollectionNotNull<T> ICollection<T>.IsNotNull()
		{
			if (Argument == null)
			{
				throw new ArgumentNullException(ParameterName);
			}
			return this;
		}
		#endregion
		#region ICollectionNotNull<T> Members
		void ICollectionNotNull<T>.IsNotEmpty()
		{
			if (Argument.Count == 0)
			{
				throw new ArgumentException("Value cannot be empty.", ParameterName);
			}
		}
		#endregion
	}
}
